﻿@model Wiwi.Models.A_vWant
@{
    ViewBag.Title = "_WantControl";
}

<div class="wiwi-pitches-box">
	
		<div class="left-col">
            <a href="/Home/UserPublicProfile?Uid=@Model.UserID" ><img height ="48" width="48" src='@Url.Action("ShowUserImage", "Home", new { Uid = @Model.UserID })' /></a>
        </div>
		
		<div class="right-col bigger-icon">
        @if (Request.IsAuthenticated)
        {
            MembershipUser usr = Membership.GetUser();
            if (usr.ProviderUserKey.ToString() != Model.UserID.ToString())
            {
                <ul class="user-choice">
				    <li><a href='/Want/Meto?Wid=@Model.WantID' class="button-s green-button">Me2 !</a></li>
				    <li><a href='/Want/Pitch?Wid=@Model.WantID.ToString()' class="button-s blue-button">Pitch !</a></li>
			    </ul>
            }
        }
        else
        {
			<ul class="user-choice">
				<li><a href='/Want/Meto?Wid=@Model.WantID' class="button-s green-button">Me2 !</a></li>
				<li><a href='/Want/Pitch?Wid=@Model.WantID.ToString()' class="button-s blue-button">Pitch !</a></li>
			</ul>
        }
	    	<h5>@Model.FName.ToString()  @if (Model.Lname != null)
                                   { @Model.Lname.ToString() }
               <br />
               @if (Model.WiwiDate.Value != null)
               {
                   string durat = "";
                   if (Model.IsCreator == true) { durat = "Posted "; }
                   else { durat = "Me2'd "; }
                   
                   TimeSpan span = DateTime.Now - Model.WiwiDate.Value;
                   if (span.Days >= 1)
                   {
                       durat += span.Days.ToString() + " Days ago";
                   }
                   else
                   {

                       if (span.Hours >= 1 )
                       {
                           durat += span.Hours.ToString() + " Hours ago";
                       }
                       else
                       {

                               durat += span.Minutes.ToString() + " Minutes ago";
                      
                       }
                   }
                 <span >@durat</span>
               }
               </h5>
	    	
    		<p class="wiwi-content">@Html.ActionLink(Model.WantDesc.ToString(), "WiwiDetails", "Home", new { wntID = Model.WantID, UsrID = Model.UserID }, null)</p>
            <p class='tagged'>Tagged ~
             @if (Model.Tags != "")
             {
                 string[] TagRows = Model.Tags.Split('$');
                 foreach (string tr in TagRows)
                 {
                     if (tr != "")
                     {
                         string[] Tagss = tr.Split('?');
                         if (Tagss[0].Trim() != "")
                         {
                            <a href='/Want/Pitch?Wuid=@Tagss[1].ToString()'>@Tagss[0]</a>
                         }
                     }
                 }
             }
             </p>              
            <div class="also-want grid_7">
            
    	    @if (Model.WantbyUsr != "")
            {
             <p class="move-left">Also <br />wanted by</p>
             string[] cntusrs = Model.WantbyUsr.Split('$');
             string[] usrs = cntusrs[0].Split('?');
             if (cntusrs.Length > 1)
             {
                 if (int.Parse(cntusrs[1]) > 6)
                 {
                     //var othcnt=cntusrs.Count() - 4;
                <p class="move-right"><a href="/Home/UserPublicProfile?Uid=@Model.UserID" class="xOthers">and @cntusrs[1] others.</a></p>
                 }
             }
             foreach (string us in usrs)
             {
                 if (us.Trim() != "")
                 {
                        <a href="/Home/UserPublicProfile?Uid=@us" ><img height ="32" width="32" src='@Url.Action("ShowUserImage", "Home", new { Uid = @us })' /></a>
                 }
             }
             
         }
             </div>

	    </div>
	</div>    

